package com.example.backend.dto;

import com.example.backend.entity.Announcement;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

public class AnnouncementDto {

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class CreateRequest {
        @NotBlank(message = "公告标题不能为空")
        @Size(max = 200, message = "公告标题长度不能超过200个字符")
        private String title;

        @NotBlank(message = "公告内容不能为空")
        private String content;

        @NotNull(message = "作者ID不能为空")
        private Long authorId;

        private Announcement.Priority priority;
        private Boolean isPinned;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class UpdateRequest {
        @Size(max = 200, message = "公告标题长度不能超过200个字符")
        private String title;

        private String content;
        private Announcement.AnnouncementStatus status;
        private Announcement.Priority priority;
        private Boolean isPinned;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Response {
        private Long id;
        private String title;
        private String content;
        private AuthorInfo author;
        private Announcement.AnnouncementStatus status;
        private Announcement.Priority priority;
        private Boolean isPinned;
        private LocalDateTime createdAt;
        private LocalDateTime updatedAt;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class AuthorInfo {
        private Long id;
        private String username;
        private String nickname;
        private String avatarUrl;
    }
}
